<%--
  Created by IntelliJ IDEA.
  User: 华哥
  Date: 2021/5/23
  Time: 11:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册</title>
    <%
        //获取项目的根路径
        String path = request.getContextPath();
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <style type="text/css">
      form{
          text-align: center;
          position: relative;
          top: -600px;
          right: -800px;
          font-size: 20px;
          background: white;
          width: 500px;
          height: 350px;
          padding-top:50px ;
      }
        span{
            display: inline-block;
            width: 100px;
        }
      #shoulan{
          border: 0px #ffffff dashed;
          background-color: #632493;
          width: 550px;
          height: 550px;
          border-radius:100%;
          margin-top: 70px;
          margin-left: 170px;
      }
      #tupian{
          background-color: #632493;
          margin-top: -670px;


      }

    </style>
    <script src="<%=basePath%>/js/jquery-1.12.4.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/sweetalert.css">
    <script type="text/javascript" src="<%=basePath%>/sweetalert-dev.js"></script>
</head>
<body>
<div id="shoulan">
</div>
<div id="tupian">
    <img src="<%=basePath%>cxq/img/tushuguan.png">
</div>

    <form method="post" action="#" style="z-index: 10">
        <p><span>真实姓名:</span><input type="text" name="name" id="name"></p>
        <p><span>实际年龄:</span><input type="text" name="age" id="age"></p>
        <p><span>身份证:</span><input type="text" name="sfz" id="sfz"></p>
        <p><span>联系电话:</span><input type="text" name="phone" id="phone"></p>
        <button id="an" style="width: 200px;background: orange;height: 30px">立即注册</button>
    </form>


<script type="text/javascript">

    $(function() {
        $("#an").click(function () {
            let name=$("#name").val();
            let age=$("#age").val();
            let sfz=$("#sfz").val();
            let phone=$("#phone").val();
            if(name.length==0){
                alert("姓名不能为空!");
            }else if(age.length==0){
                alert("年龄不能为空!");
            }else if(sfz.length==0){
                alert("身份证不能为空!");
            }else if(phone.length==0){
                alert("联系电话不能为空!");
            }else {
                $.ajax(
                    {
                        url:"<%=basePath%>ReaderLogin",
                        data:{
                            name:name,
                            age:age,
                            phone:phone,
                            idCard:sfz,
                            tp:"register"
                        },
                        type:"post",
                        dataType:"json",
                        success:function (data) {
                                swal("注册成功！您的卡号是"+data+"密码初始密码为123456");
                        }
                    });
            }
        })

        })
    </script>
</body>
</html>
